<?php
/**
 * Created by PhpStorm.
 * User: Inhere
 * Date: 2015/2/26
 * Time: 20:05
 * Use :
 * File: Cookie.php
 */

namespace ulue\core\request;

use ulue\libs\datastorage\SimpleDatastorage;

class Cookie extends SimpleDatastorage
{

    public function __construct()
    {
        $this->data = &$_COOKIE;
    }

    public function set($name , $value, $expire=0 , $path='/' , $domain=null , $secure=false , $httpOnly=false)
    {
        setcookie($name, $value, $expire, $path, $domain, $secure, $httpOnly);

        return $this;
    }

    /**
     * @param $name
     */
    public function del($name)
    {
        setcookie($name, null, -1);

        unset($_COOKIE[$name]);
    }
}